package reserved

import (
	"jvm/nzpJvm/instructions/base"
	"jvm/nzpJvm/native"
	"jvm/nzpJvm/runtime_area"
)

type INVOKE_NATIVE struct {
	base.NoOperandsInstruction
}

func (self *INVOKE_NATIVE)Execute(frame *runtime_area.Frame){
	method := frame.Method()
	className := method.Class().Name()
	methodName := method.Name()
	descriptor := method.Descriptor()

	nativeMethod := native.FindNativeMethod(className, methodName, descriptor)

	if nativeMethod == nil {
		panic("java.lang.UnsatisfiedLinkError")
	}
	nativeMethod(frame)
}
